<template>
	<div class="dianji">
		<search @searchFn="searchFn"></search>
		<div class="dianji_content" v-for="(item,index) in list.rows" :key="index" @click="jumplist(item)">
			<div class="list">
				<span class="_span">{{item.name}}</span>
			</div>
			<div class="text">
				<p class="title">{{item.name}}</p>
				<p class="content">{{item.desc}}</p>
			</div>
		</div>
	</div>
</template>

<script>
	import search from '../../components/search.vue'
	
	export default{
		components:{
			search
		},
		data(){
			return{
				list:[],
				content:""
			}
			},
			onLoad() {
				this.getList()
			},
			onShareAppMessage(res) {
					wx.showShareMenu({
					     withShareTicket: true,
					     menus: ['shareAppMessage', 'shareTimeline']
					    })
					return{
							title:"一起来学古诗词吧",
							imageUrl:'https://www.leedong.top/img/11556.png'
					}
					
					},
					//2.分享到朋友圈
			onShareTimeline(){
			
				return {
					title: '一起来学古诗词吧',
						imageUrl:'https://www.leedong.top/img/11556.png'
					
				}
			},
			methods:{
				jumplist(item){
					let name=item.name;
					if(name=='本草纲目'){
						uni.navigateTo({
							url:"/pageB/bencaogangmu/bencaogangmu?name="+item.name+'&desc='+item.desc
						})
					}else if(name=='传习录'){
						uni.navigateTo({
							url:"/pageB/chuanxilu/chuanxilu?name="+item.name+'&desc='+item.desc
						})
					}else if(name=='楚辞'){
						uni.navigateTo({
							url:"/pageB/chuci/chuci?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='道德经'){
						uni.navigateTo({
							url:"/pageB/daodejing/daodejing?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='地藏经'){
						uni.navigateTo({
							url:"/pageB/dizangjing/dizangjing?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='鬼谷子'){
						uni.navigateTo({
							url:"/pageB/guiguzi/guiguzi?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='汉书'){
						uni.navigateTo({
							url:"/pageB/hanshu/hanshu?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='淮南子'){
						uni.navigateTo({
							url:"/pageB/huainanzi/huainanzi?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='黄帝内经'){
						uni.navigateTo({
							url:"/pageB/huangdineijing/huangdineijing?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='将苑'){
						uni.navigateTo({
							url:"/pageB/jiangyuan/jiangyuan?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='金刚经'){
						uni.navigateTo({
							url:"/pageB/jingangjing/jingangjing?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='列子'){
						uni.navigateTo({
							url:"/pageB/liezi/liezi?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='礼记'){
						uni.navigateTo({
							url:"/pageB/liji/liji?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='六祖坛经'){
						uni.navigateTo({
							url:"/pageB/liuzutanjing/liuzutanjing?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='论语'){
						uni.navigateTo({
							url:"/pageB/lunyu/lunyu?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='孟子'){
						uni.navigateTo({
							url:"/pageB/mengzi/mengzi?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='妙法莲花经'){
						uni.navigateTo({
							url:"/pagesA/miaofalianhuajing/miaofalianhuajing?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='墨子'){
						uni.navigateTo({
							url:"/pagesA/mozi/mozi?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='难经'){
						uni.navigateTo({
							url:"/pagesA/nanjing/nanjing?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='伤寒论'){
						uni.navigateTo({
							url:"/pagesA/shanghanlun/shanghanlun?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='山海经'){
						uni.navigateTo({
							url:"/pagesA/shanhaijing/shanhaijing?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='神农本草经'){
						uni.navigateTo({
							url:"/pagesA/shennongbencaojing/shennongbencaojing?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='史记'){
						uni.navigateTo({
							url:"/pagesA/shiji/shiji?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='史通'){
						uni.navigateTo({
							url:"/pagesA/shitong/shitong?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='四十二章经'){
						uni.navigateTo({
							url:"/pagesA/sishierzhangjing/sishierzhangjing?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='孙子兵法'){
						uni.navigateTo({
							url:"/pagesA/sunzibingfa/sunzibingfa?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='维摩诘经'){
						uni.navigateTo({
							url:"/pagesA/weimojiejing/weimojiejing?name="+item.name+'&desc='+item.desc
						})
					}
					
					else if(name=='孝经'){
						uni.navigateTo({
							url:"/pagesA/xiaojing/xiaojing?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='圆觉经'){
						uni.navigateTo({
							url:"/pagesA/yuanjuejing/yuanjuejing?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='战国策'){
						uni.navigateTo({
							url:"/pagesA/zhanguoce/zhanguoce?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='中庸'){
						uni.navigateTo({
							url:"/pagesA/zhongyong/zhongyong?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='周易'){
						uni.navigateTo({
							url:"/pagesA/zhouyi/zhouyi?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='庄子'){
						uni.navigateTo({
							url:"/pagesA/zhuangzi/zhuangzi?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='资治通鉴'){
						uni.navigateTo({
							url:"/pagesA/zizhitongjian/zizhitongjian?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='左传'){
						uni.navigateTo({
							url:"/pagesA/zuozhuan/zuozhuan?name="+item.name+'&desc='+item.desc
						})
					}
					else if(name=='百家姓'){
						uni.navigateTo({
							url:"/pagesA/baijiaxing/baijiaxing"
						})
					}
					else if(name=='千字文'){
						uni.navigateTo({
							url:"/pagesA/qianziwen/qianziwen"
						})
					}
					else if(name=='声律启蒙'){
						uni.navigateTo({
							url:"/pagesA/shenglvqimeng/shenglvqimeng"
						})
					}
					else if(name=='三字经'){
						uni.navigateTo({
							url:"/pagesA/sanzijing/sanzijing"
						})
					}
					else if(name=='弟子规'){
						uni.navigateTo({
							url:"/pageB/dizigui/dizigui"
						})
					}
					
					
									
				},
				searchFn(name){
					this.content=name;
					this.getList()
				},
				async getList(){
					this.list = await this.$api.dianji({
						seachVal:this.content
					});
					console.log(this.list,"90909")
				}
			}
			}
</script>

<style lang="scss">
	.dianji{
		.dianji_content{
			display: flex;
			margin-top: 20px;
			border-bottom: 1px solid #ffdcdc;
			margin-bottom: 10px;
			height: 160px;
			.list{
				width: 24%;
				height: 150px;
				
				background-image: url('https://www.leedong.top/img/dianji1.png');
				
				background-size: 100% 100%;
				._span{
					    writing-mode: tb-rl;
					    padding-left: 12px;
					    padding-top: 21px;
					    font-size: 12px;
					    font-weight: 800;
				}
			}
			.text{
				width: 69%;
				padding-left:20px;
				
				.title{
					color: $color;
					font-size: 30rpx;
				}
				.content{
					font-size: 25rpx;
					line-height: 18px;
					color:#616161;
					
					padding-top: 10px;
					text-indent: 4ch;
					overflow:hidden;
					text-overflow:ellipsis;
					display:-webkit-box;
					-webkit-line-clamp:6;
					-webkit-box-orient:vertical;
					
				}
			}
		}
	}
</style>